home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / SampleView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  6.8 KB  |  176 lines  |  [TEXT/KAHL]

  1. /* SampleView.h */
  2.  
  3. #ifndef Included_SampleView_h
  4. #define Included_SampleView_h
  5.  
  6. /* SampleView module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* SampleStorageDisplay */
  12. /* FixedPoint */
  13. /* Screen */
  14. /* Memory */
  15. /* SampleConsts */
  16.  
  17. #include "Screen.h"
  18. #include "FixedPoint.h"
  19. #include "SampleConsts.h"
  20.  
  21. #define MINIMUMHORIZSCALE (0.001)
  22.  
  23. struct SampleViewRec;
  24. typedef struct SampleViewRec SampleViewRec;
  25.  
  26. /* forwards */
  27. struct SampleStorageDisplayRec;
  28.  
  29. /* create a new sample view that will display the specified storage object. */
  30. SampleViewRec*            NewSampleView(WinType* Screen, OrdType XLoc, OrdType YLoc,
  31.                                             OrdType Width, OrdType Height,
  32.                                             struct SampleStorageDisplayRec* TheRawData);
  33.  
  34. /* dispose of the sample view.  the raw data object is also disposed. */
  35. void                                DisposeSampleView(SampleViewRec* View);
  36.  
  37. /* redraw one displayed sample line, at the specified X coordinate */
  38. void                                RedrawSampleViewOneLine(SampleViewRec* View, OrdType XPixel);
  39.  
  40. /* redraw the entire sample view area */
  41. void                                RedrawSampleView(SampleViewRec* View);
  42.  
  43. /* return the left edge of the sample view area */
  44. OrdType                            GetSampleViewXLoc(SampleViewRec* View);
  45.  
  46. /* return the top edge of the sample view area */
  47. OrdType                            GetSampleViewYLoc(SampleViewRec* View);
  48.  
  49. /* return the width of the sample view area */
  50. OrdType                            GetSampleViewWidth(SampleViewRec* View);
  51.  
  52. /* return the height of the sample view area */
  53. OrdType                            GetSampleViewHeight(SampleViewRec* View);
  54.  
  55. /* return the number of bits that the sample storage object has */
  56. NumBitsType                    GetSampleViewNumBits(SampleViewRec* View);
  57.  
  58. /* return the number of channels that the sample has */
  59. NumChannelsType            GetSampleViewNumChannels(SampleViewRec* View);
  60.  
  61. /* return the number of sample frames in the sample */
  62. long                                GetSampleViewNumFrames(SampleViewRec* View);
  63.  
  64. /* return one point from the sample array.  for mono samples, WhichChannel must be */
  65. /* eMonoChannel.  for stereo samples, it must either be eRightChannel or eLeftChannel */
  66. largefixedsigned        GetSampleViewValue(SampleViewRec* View, long Index,
  67.                                             ChannelType WhichChannel);
  68.  
  69. /* return the index of the leftmost displayed sample frame */
  70. long                                GetSampleViewXOffset(SampleViewRec* View);
  71.  
  72. /* return the scaling factor (zoom in/out).  large numbers are compress more. */
  73. double                            GetSampleViewHorizontalScale(SampleViewRec* View);
  74.  
  75. /* get the start point of the selection */
  76. long                                GetSampleViewSelectStart(SampleViewRec* View);
  77.  
  78. /* get the end point of the selection */
  79. long                                GetSampleViewSelectEnd(SampleViewRec* View);
  80.  
  81. /* return the number of frames that are currently displayed. */
  82. long                                GetSampleViewNumVisibleFrames(SampleViewRec* View);
  83.  
  84. /* return True if the data has been modified since the last time it was saved */
  85. MyBoolean                        DoesSampleViewNeedToBeSaved(SampleViewRec* View);
  86.  
  87. /* returns True if there is a selection or False if there is an insertion point. */
  88. MyBoolean                        SampleViewIsThereValidSelection(SampleViewRec* View);
  89.  
  90. /* move the sample view to a new location and redraw */
  91. void                                SetSampleViewLocation(SampleViewRec* View, OrdType XLoc,
  92.                                             OrdType YLoc, OrdType Width, OrdType Height);
  93.  
  94. /* change the number of bits the sample is stored as */
  95. MyBoolean                        SetSampleViewNumBits(SampleViewRec* View,
  96.                                             NumBitsType NewNumBits);
  97.  
  98. /* change the number of channels the sample has */
  99. MyBoolean                        SetSampleViewNumChannels(SampleViewRec* View,
  100.                                             NumChannelsType NewNumChannels);
  101.  
  102. /* change the value of one sample point.  this does not redraw the screen */
  103. void                                SetSampleViewValue(SampleViewRec* View, long Index,
  104.                                             ChannelType WhichChannel, largefixedsigned NewValue);
  105.  
  106. /* change the index into the sample that is being displayed. */
  107. void                                SetSampleViewXOffset(SampleViewRec* View, long NewXOffset);
  108.  
  109. /* change the horizontal scaling factor */
  110. void                                SetSampleViewHorizontalScale(SampleViewRec* View,
  111.                                             double NewHorizontalScale);
  112.  
  113. /* set a selection.  if the selection is invalid, it will be corrected. */
  114. void                                SetSampleViewSelection(SampleViewRec* View, long Start, long End);
  115.  
  116. /* make sure the selection is correct (i.e. not out of range) */
  117. void                                SampleViewValidateSelection(SampleViewRec* View);
  118.  
  119. /* clear the not-saved flag.  this is called when the file is saved */
  120. void                                SampleViewHasBeenSaved(SampleViewRec* View);
  121.  
  122. /* make a copy of the data in NewData & store it in the current sample.  NewData is */
  123. /* not disposed. */
  124. MyBoolean                        SampleViewSetContents(SampleViewRec* View,
  125.                                             struct SampleStorageDisplayRec* NewData);
  126.  
  127. /* insert a zero area into the sample.  returns True if successful. */
  128. MyBoolean                        InsertSampleViewArea(SampleViewRec* View, long Index,
  129.                                             long NumFramesToInsert);
  130.  
  131. /* delete an area from the sample.  returns True if successful. */
  132. MyBoolean                        DeleteSampleViewArea(SampleViewRec* View, long Index,
  133.                                             long NumFramesToDelete);
  134.  
  135. /* extract a section of the sample & return a new sample object containing it. */
  136. struct SampleStorageDisplayRec*    ExtractSampleViewSection(SampleViewRec* View, long Index,
  137.                                             long NumFramesToExtract);
  138.  
  139. /* insert a sample into our sample at a specified point.  returns True if successful */
  140. MyBoolean                        InsertSampleViewSection(SampleViewRec* View, long Index,
  141.                                             struct SampleStorageDisplayRec* DataToInsert);
  142.  
  143. /* get a copy of the specified channel as an array of fixedpoint numbers */
  144. largefixedsigned*        SampleViewGetChannelFixed(SampleViewRec* View,
  145.                                             ChannelType WhichChannel);
  146.  
  147. /* store a new array of data into the sample (replacing old contents).  returns */
  148. /* True if successful.  this can only be used for mono samples. */
  149. MyBoolean                        SampleViewPutMonoFixed(SampleViewRec* View, largefixedsigned* Data);
  150.  
  151. /* store new arrays of data into the sample (replacing old contents).  returns True */
  152. /* if successful.  this can only be used for stereo samples. */
  153. MyBoolean                        SampleViewPutStereoFixed(SampleViewRec* View, largefixedsigned* Left,
  154.                                             largefixedsigned* Right);
  155.  
  156. /* the user is responsible for calling undo routines; none of the routines in */
  157. /* this package call them. */
  158.  
  159. /* flush undo information. */
  160. void                                SampleViewFlushUndo(SampleViewRec* View);
  161.  
  162. /* save the current sample configuration into the undo information. */
  163. MyBoolean                        SampleViewSetupForUndo(SampleViewRec* View);
  164.  
  165. /* find out if it is possible to restore state to the last SampleViewSetupForUndo() */
  166. MyBoolean                        SampleViewUndoAvailable(SampleViewRec* View);
  167.  
  168. /* attempt to undo.  returns True if successful.  this call swaps the current sample */
  169. /* state with that saved from the last call to SampleViewSetupForUndo(). */
  170. MyBoolean                        SampleViewUndo(SampleViewRec* View);
  171.  
  172. /* get the actual raw sample data */
  173. largefixedsigned*        SampleViewGetActualRawData(SampleViewRec* View);
  174.  
  175. #endif
  176.